package doudizhu1;

import java.util.ArrayList;
import java.util.Collections;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 33013
 * Date: 2023-04-05
 * Time: 14:45
 */
public class PokerGame {

    static ArrayList<String> list = new ArrayList<>();

    static {
        String[] color = {"♣", "♥", "♠", "◆"};
        String[] numbers = {"3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A", "2"};

        for (String c: color) {
            for (String n: numbers) {
                list.add(c + n);
            }
        }

        list.add("小王");
        list.add("大王");

    }

    public PokerGame() {
        Collections.shuffle(list);
        ArrayList<String> lord = new ArrayList<>();
        ArrayList<String> player1 = new ArrayList<>();
        ArrayList<String> player2 = new ArrayList<>();
        ArrayList<String> player3 = new ArrayList<>();

        for (int i = 0; i < list.size(); i++) {
            if (i <= 2) {
                lord.add(list.get(i));
                continue;
            }
            if (i % 3 == 0) {
                player1.add(list.get(i));
            }
            if (i % 3 == 1) {
                player2.add(list.get(i));
            }
            if (i % 3 == 2) {
                player3.add(list.get(i));
            }

        }
        lookPoker("底牌",lord);
        lookPoker("胡歌",player1);
        lookPoker("富大龙",player2);
        lookPoker("吴彦祖",player3);
    }

    public static void lookPoker(String name,ArrayList<String> list){
        System.out.println(name + ": ");
        for (String s : list) {
            System.out.print(s + " ");
        }
        System.out.println();
    }
}
